//package com.example.springai.config;
//
//import org.neo4j.driver.AuthTokens;
//import org.neo4j.driver.Driver;
//import org.neo4j.driver.GraphDatabase;
//import org.springframework.ai.document.MetadataMode;
//import org.springframework.ai.embedding.EmbeddingModel;
//import org.springframework.ai.embedding.TokenCountBatchingStrategy;
//import org.springframework.ai.openai.OpenAiEmbeddingModel;
//import org.springframework.ai.openai.OpenAiEmbeddingOptions;
//import org.springframework.ai.openai.api.OpenAiApi;
//import org.springframework.ai.retry.RetryUtils;
//import org.springframework.ai.vectorstore.VectorStore;
//import org.springframework.ai.vectorstore.neo4j.Neo4jVectorStore;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//
//
//@Configuration
//public class Neo4jConfig {
//
//
//    @Bean
//    @Primary
//    public EmbeddingModel neo4jembeddingModel() {
//        OpenAiApi build = OpenAiApi.builder().apiKey("sk-nrvjihoykgbjabnelziszukgkcankraqcwtvohvpcuepuyyz").baseUrl("https://api.siliconflow.cn").build();
//
//        return new OpenAiEmbeddingModel(
//                build,
//                MetadataMode.EMBED,
//                OpenAiEmbeddingOptions.builder()
//                        .dimensions(1536)
////                        .dimensions()
//                        .encodingFormat("float")
//                        .model("Pro/BAAI/bge-m3")
//                        .build(),
//                RetryUtils.DEFAULT_RETRY_TEMPLATE);
//    }
//    @Bean
//    public Driver driver() {
//        return GraphDatabase.driver("neo4j://localhost:7687",
//                AuthTokens.basic("neo4j", "password")
//        );
//    }
//
//    @Bean(name = "neo4jVectorStore")
//    public VectorStore neo4jVectorStore(Driver driver, @Qualifier("neo4jembeddingModel") EmbeddingModel Neo4jembeddingModel) {
//        return Neo4jVectorStore.builder(driver, Neo4jembeddingModel)
//                .databaseName("neo4j")                // Optional: defaults to "neo4j"
//                .distanceType(Neo4jVectorStore.Neo4jDistanceType.COSINE)
//                .embeddingDimension(1024)// Optional: defaults to COSINE
//                .label("Document")                     // Optional: defaults to "Document"
//                .embeddingProperty("embedding")        // Optional: defaults to "embedding"
//                .indexName("custom-index")             // Optional: defaults to "spring-ai-document-index"
//                .initializeSchema(true)                // Optional: defaults to false
//                .batchingStrategy(new TokenCountBatchingStrategy()) // Optional: defaults to TokenCountBatchingStrategy
//                .build();
//    }
//
//    // This can be any EmbeddingModel implementation
//
//}
